package com.morty.user.controller;

import com.morty.user.vo.UserInfoVo;
import com.morty.user.vo.UserLockVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Api(value = "用户管理API", tags = {"用户管理API"})
@Component
@FeignClient(name = "management", path="/management/user", contextId = "userControllerApi")
public interface UserControllerApi {

    @ApiOperation(value = "查询用户信息")
    @ApiImplicitParams(
            @ApiImplicitParam(name = "userId", value = "userId", paramType = "path", required = true, dataType = "String")
    )
    @RequestMapping(value = "/getUserById/{userId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
    public UserInfoVo getUserById(@PathVariable("userId") String userId);

    @ApiOperation(value = "查询用户Lock信息")
    @ApiImplicitParams(
            @ApiImplicitParam(name = "userId", value = "userId", paramType = "path", required = true, dataType = "String")
    )
    @RequestMapping(value = "/getUserLockById/{userId}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)

    public UserLockVo getUserLockById(@PathVariable("userId") String userId);

    @ApiOperation(value = "新增")
    @ApiImplicitParams(
            @ApiImplicitParam(name = "userInfoVo", value = "表单数据实体", paramType = "body", required = true, dataType = "UserInfoVo")
    )
    @PostMapping(value = "/insertUser", produces = MediaType.APPLICATION_JSON_VALUE)
    public int insertUser(@Validated @RequestBody UserInfoVo userInfoVo);

    @ApiOperation(value = "修改")
    @ApiImplicitParams(
            @ApiImplicitParam(name = "userInfoVo", value = "表单数据实体", paramType = "body", required = true, dataType = "UserInfoVo")
    )
    @PostMapping(value = "/updateUser", produces = MediaType.APPLICATION_JSON_VALUE)
    public int updateUser(@Validated @RequestBody UserInfoVo userInfoVo);

    @ApiOperation(value = "修改Lock")
    @ApiImplicitParams(
            @ApiImplicitParam(name = "userLockVo", value = "表单数据实体", paramType = "body", required = true, dataType = "UserLockVo")
    )
    @PostMapping(value = "/updateUserLock", produces = MediaType.APPLICATION_JSON_VALUE)
    public int updateUserLock(@Validated @RequestBody UserLockVo userLockVo);
}
